package com.itheima.netmarket.impl.view;

import com.itheima.netmarket.impl.view.manager.UIManagerImpl;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import comitheima.netmarket.R;

/**
 * 购物车页面
 * 
 * @author Jeffery
 * 
 */
public class ShoppingCart extends MainView {
	private View shoppingCart; // 当前的界面的View;

	private TextView updateTv; // 标题的编辑按钮
	private TextView payTv;// 标题的提交按钮
	private ListView productLv;// 商品展示的listView
	private TextView buyCountTv;// 购物车数量总数
	private TextView totalBonusTv;// 赠送的积分
	private TextView totalMoneyTv;// 商品总金额
	private TextView privilegeTv;// 优惠信息
	private TextView toBuyTv;// 随便逛逛按钮
	private RelativeLayout nullRl;// 购物车为空时的显示
	private ScrollView showSv;// 购物车不为空时的显示

	public ShoppingCart(Context context) {
		super(context);
		onCreate();
		setListener();
	}

	public ShoppingCart(Context context, Bundle bundle) {
		super(context, bundle);
		onCreate();
		setListener();
	}

	@Override
	public View getmView() {
		return shoppingCart;
	}

	@Override
	public void onCreate() {
		shoppingCart = View.inflate(context, R.layout.shopping_car_activity, null);
		showSv = (ScrollView) shoppingCart.findViewById(R.id.shopcar_body_srcoll);

		updateTv = (TextView) shoppingCart.findViewById(R.id.shopcar_update_text);
		payTv = (TextView) shoppingCart.findViewById(R.id.shopcar_toPay_text);
		productLv = (ListView) shoppingCart.findViewById(R.id.shopcar_product_list);
		buyCountTv = (TextView) shoppingCart.findViewById(R.id.shopcar_total_buycount_text);
		totalBonusTv = (TextView) shoppingCart.findViewById(R.id.shopcar_total_bonus_text);
		totalMoneyTv = (TextView) shoppingCart.findViewById(R.id.shopcar_total_money_text);
		privilegeTv = (TextView) shoppingCart.findViewById(R.id.shopcar_privilege_text);

		nullRl = (RelativeLayout) shoppingCart.findViewById(R.id.shopcart_null);
		toBuyTv = (TextView) shoppingCart.findViewById(R.id.shopcar_toBuy_text);
		setListener();
		// productLv.setAdapter();
	}
	
	public void setListener(){
		payTv.setOnClickListener(this);
		
	}
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.shopcar_toPay_text:
				UIManagerImpl.getInstance().changeView(PayCenterView.class);
				break;
			 
		}
	}

}
